package cn.edu.cug.cs.gtl.docsrv.dict.dao.imp;

import cn.edu.cug.cs.gtl.docsrv.config.Configuration;
import cn.edu.cug.cs.gtl.docsrv.dict.dao.DictDataSourceDao;
import cn.edu.cug.cs.gtl.mybatis.Session;
import cn.edu.cug.cs.gtl.mybatis.mapper.dict.DictCatalogMapper;
import cn.edu.cug.cs.gtl.mybatis.mapper.dict.DictDataSource;
import cn.edu.cug.cs.gtl.mybatis.mapper.dict.DictDataSourceMapper;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
public class DictDataSourceDaoImpl implements DictDataSourceDao {
    @Override
    public List<DictDataSource> getDataSources() throws Exception {
        Session s = Configuration.getSession();
        DictDataSourceMapper mapper = s.getMapper(DictDataSourceMapper.class);
        List<DictDataSource> l =   mapper.selectAll();
        s.close();
        return l;
    }
}
